<?php
namespace app\api\controller;
use app\BaseController;
use app\common\model\mysql\User;
use app\Request;
use think\App;

class Index extends BaseController
{
    public function index()
    {
        return '学习TP6';
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }
    public function userInfo(Request $request){
        $id=$request->param('id');
        $user=new User();
        $data=$user->getUserInfo($id);
        return json($data);
    }
    //查询tp_user 表所有数据
    public function  getAlluser(){
        $alluser=new User();
        $data=$alluser->select(32);
//        if(empty($data->toArray())){
//            return show(200,'获取数据为空',[],200);
//        }
        return show(200,'获取数据成功',$data,200);

    }
}
